<!-- components/order/ReportSelection.vue -->
<template>
  <uni-card :is-shadow="false">
    <uni-title type="h2" title="工单主流程报表" align="center"></uni-title>
    <radio-group @change="handleChange" class="full-width-radio-group">
      <label class="custom-radio" v-for="(item, index) in items" :key="item.value">
        <view class="radio-wrapper">
          <radio :value="item.value" :checked="index === current" hidden />
          <view class="radio-inner">
            <view class="radio-dot" :class="{ 'radio-checked': index === current }"></view>
            <view class="radio-text">{{ item.name }}</view>
          </view>
        </view>
      </label>
    </radio-group>
  </uni-card>
</template>

<script>
export default {
  props: {
    items: {
      type: Array,
      default: () => []
    },
    current: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleChange(evt) {
      this.$emit('change', evt.detail.value)
    }
  }
}
</script>

<style scoped>
/* 移动相关样式到该组件 */
.full-width-radio-group {
  width: 100%;
  box-sizing: border-box;
}

.custom-radio {
  position: relative;
  padding: 12px;
  margin: 15px 0;
  border: 1px solid #c1c1c1;
  border-radius: 8px;
  display: flex;
  align-items: center;
}

.radio-inner {
  display: flex;
  align-items: center;
  width: 100%;
}

.radio-dot {
  width: 20px;
  height: 20px;
  border: 2px solid #d9d9d9;
  margin-right: 12px;
  position: relative;
}

.radio-checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #1890ff;
  border-radius: 50%;
}

.radio-text {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.85);
}
</style>